
package com.wzt.lianfirecontrol.dao;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import java.lang.ref.WeakReference;

public abstract class MyHandler extends Handler {

    private WeakReference<Context> mActivityReference;

    public MyHandler(Context context) {
        mActivityReference = new WeakReference<Context>(context);
    }
    
    @Override
    public void handleMessage(Message msg) {
        if (null != mActivityReference.get()) {
            dealWithMsg(msg);
        }
    }
    
    public abstract void dealWithMsg(Message msg);
}
